package cn.panda.edu.service.impl;

import cn.panda.edu.dao.StudentWorkMapper;
import cn.panda.edu.model.Notice;
import cn.panda.edu.model.StudentWork;
import cn.panda.edu.service.StudentWorkService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 苑庆涛
 * @create 2019-03-08 9:49
 */
@Service
public class StudentWorkServiceImpl implements StudentWorkService {
    @Autowired
    private StudentWorkMapper studentWorkMapper;

    @Override
    public PageInfo<StudentWork> selectWorkByPage(String name, Integer pageIndex, Integer pageSize) {
        Page<StudentWork> notices = PageHelper.startPage(pageIndex, 5);
        studentWorkMapper.findList(name);
        PageInfo<StudentWork> pageInfo = new PageInfo<>(notices);
        return pageInfo;
    }

    @Override
    public Integer insert(StudentWork studentWork) {
        return studentWorkMapper.insert(studentWork);
    }

    @Override
    public Integer delete(Integer id) {
        return studentWorkMapper.deleteByPrimaryKey(id);
    }
}
